<template>
  <div class="mySearch">
    <div class="logo">
      <slot name="logoImg"></slot>
    </div>
    <div class="searchBox" @click="gotoSearch">
      <slot name="search">
        <div>
          <van-icon class="icon" name="search" />
          <span class="text">{{ title }}</span>
        </div>
      </slot>
    </div>
    <!-- 根据token是否显示登录按钮 -->
    <div>
      <slot name="login"> </slot>
    </div>
  </div>
</template>

<script lang="ts">
// import router from '../router/index'
import { useRouter } from "vue-router";
export default {
  name: "Search",
  props: {
    title: {
      type: String,
      default: "",
    },
  },
};
</script>

<script setup lang="ts">
const router = useRouter();
const gotoSearch = () => {
  router.push("/search");
  console.log(1231321);
};
</script>

<style lang="less" scoped>
.mySearch {
  .logo {
    font-size: 20px;
    padding: 0px;
    box-sizing: border-box;
  }
  height: 28px;
  width: 365px;
  display: flex;
  padding: 5px 10px;
  box-sizing: border-box;
  margin: 0 auto;
  .searchBox {
    background-color: #eee;
    border-radius: 5px;
    height: 28px;
    text-align: center;
    flex: 1;
    display: flex;
    justify-content: center;
    line-height: 28px;
    div {
      .icon {
        font-size: 18px;
        display: inline-block;
      }
      font-size: 14px;
      display: inline-block;
      display: -webkit-box !important;
      overflow: hidden;
      word-break: break-all;
      text-overflow: ellipsis;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }
  }
}
</style>
